<?php
/*==========================================================================*\
| AGRIVIET - CONTENT MANAGERMENT SYSTEM						
\*==========================================================================*/
	define('DB_SERVER', 'localhost');
	define('DB_SERVER_USERNAME', 'root');
	define('DB_SERVER_PASSWORD', 'root');
	define('DB_DATABASE', 'osc');
	define('USE_PCONNECT', 'false');
	define('STORE_SESSIONS', 'mysql');
	define('HEADING_TITLE', 'Server Information');
	define('TITLE_SERVER_HOST', 'Server Host:');
	define('TITLE_SERVER_OS', 'Server OS:');
	define('TITLE_SERVER_DATE', 'Server Date:');
	define('TITLE_SERVER_UP_TIME', 'Server Up Time:');
	define('TITLE_HTTP_SERVER', 'HTTP Server:');
	define('TITLE_PHP_VERSION', 'PHP Version:');
	define('TITLE_ZEND_VERSION', 'Zend:');
	define('TITLE_DATABASE_HOST', 'Database Host:');
	define('TITLE_DATABASE', 'Database:');
	define('TITLE_DATABASE_DATE', 'Datebase Date:');
	
// Retreive server information
  function tep_get_system_information() {
    global $HTTP_SERVER_VARS, $host;

    $db_query = mysql_query("select now() as datetime");
    $db =mysql_fetch_array($db_query);

    list($system, $host, $kernel) = preg_split('/[\s,]+/', @exec('uname -a'), 5);

    return array('date' =>date('Y-m-d H:i:s', mktime()),
                 'system' => $system,
                 'kernel' => $kernel,
                 'host' => $host,
                 'ip' => gethostbyname($host),
                 'uptime' => @exec('uptime'),
                 'http_server' => $HTTP_SERVER_VARS['SERVER_SOFTWARE'],
                 'php' => PHP_VERSION,
                 'zend' => (function_exists('zend_version') ? zend_version() : ''),
                 'db_server' => DB_SERVER,
                 'db_ip' => gethostbyname(DB_SERVER),
                 'db_version' => 'MySQL ' . (function_exists('mysql_get_server_info') ? mysql_get_server_info() : ''),
                 'db_date' => $db['datetime']);
  }
  
    function tep_datetime_short($raw_datetime) {
    if ( ($raw_datetime == '0000-00-00 00:00:00') || ($raw_datetime == '') ) return false;

    $year = (int)substr($raw_datetime, 0, 4);
    $month = (int)substr($raw_datetime, 5, 2);
    $day = (int)substr($raw_datetime, 8, 2);
    $hour = (int)substr($raw_datetime, 11, 2);
    $minute = (int)substr($raw_datetime, 14, 2);
    $second = (int)substr($raw_datetime, 17, 2);

    return strftime(DATE_TIME_FORMAT, mktime($hour, $minute, $second, $month, $day, $year));
  }
$system = tep_get_system_information();
?>

<table width="100%" border="1" cellpadding="2" cellspacing="2" bordercolor="#D5E2FF">
      <tr>
        <td class="xtitle" height="25">Server Information</td>
      </tr>
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
          <tr>
            <td><table border="0" cellspacing="0" cellpadding="3">
              <tr>
                <td><strong>Server Host:</strong></td>
                <td><?php echo $system['host'] . ' (' . $system['ip'] . ')'; ?></td>
                <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>Database Host</strong></td>
                <td><?php echo $system['db_server'] . ' (' . $system['db_ip'] . ')'; ?></td>
              </tr>
              <tr>
                <td><strong>Server OS:</strong></td>
                <td><?php echo $system['system'] . ' ' . $system['kernel']; ?></td>
                <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>Database:</strong></td>
                <td><?php echo $system['db_version']; ?></td>
              </tr>
              <tr>
                <td><strong>Server Date:</strong></td>
                <td><?php echo $system['date']; ?></td>
                <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>Datebase Date:</strong></td>
                <td><?php echo $system['db_date']; ?></td>
              </tr>
              <tr>
                <td><strong>Server Up Time:</strong></td>
                <td colspan="3"><?php echo $system['uptime']; ?></td>
              </tr>
              <tr>
                <td colspan="4"><?php #echo tep_draw_separator('pixel_trans.gif', '1', '5'); ?></td>
              </tr>
              <tr>
                <td><strong>HTTP Server:</strong></td>
                <td colspan="3"><?php echo $system['http_server']; ?></td>
              </tr>
              <tr>
                <td><strong>PHP Version:</strong></td>
                <td colspan="3"><?php echo $system['php'] . ' (' . TITLE_ZEND_VERSION . ' ' . $system['zend'] . ')'; ?></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td>
<?php
  if (function_exists('ob_start')) {
?>
<style type="text/css">

.p {text-align: left;}
.e {background-color: #ccccff; font-weight: bold;}
.h {background-color: #9999cc; font-weight: bold;}
.v {background-color: #cccccc;}
i {color: #666666;}
hr {display: none;}
</style>
<?php
    ob_start();
    phpinfo();
    $phpinfo = ob_get_contents();
    ob_end_clean();

    $phpinfo = str_replace('border: 1px', '', $phpinfo);
    ereg('<body>(.*)</body>', $phpinfo, $regs);

    echo $regs[1];
  } else {
    phpinfo();
  }
?>
        </td>
      </tr>
</table>
